% plot the boundary accuracy before and after crf refinement
%
clear all; close all;

save_folder = '.';

export_fig_dir = '~/workspace/ext/export_fig';
addpath(export_fig_dir);

fontSize = 20;
lineWidth = 2;

subsample = 3;

cols = [...    
    173 90 90; ...    
    165 165 82; ...
    92 173 173; ...
    128 128 192; ...
    ] / 255;

% % VOC2012 results
% row1: noup, row2: ms, row3: noup+crf, row4: ms+crf
pixelIOU = [39.1437885768888,40.9174913566480,42.5750968327488,44.1119698229399,45.5143333902976,46.7888007054941,47.9474395959582,48.9987195339916,49.9562761308168,50.8274348079370,51.6199418151972,52.3408776226153,53.0048800416164,53.6173863958030,54.1802129076264,54.6989675611266,55.1792759482687,55.6237417417372,56.0373525024838,56.4224864728447,56.7805992879315,57.1134185595957,57.4236637950213,57.7139226511121,57.9870942964121,58.2434411759406,58.4820168827609,58.7026272392923,58.9082213822727,59.0998098338864,59.2780799882757,59.4445643572098,59.6001745920688,59.7455099141624,59.8805382908630,60.0065637761586,60.1242322555913,60.2333065445936,60.3344098524545,60.4283472979397;
                   43.3002715583188,45.3375687909233,47.0705574224598,48.5699513073179,49.8596675676920,50.9889291376892,51.9876945842465,52.8746020024986,53.6703873892430,54.3877086876755,55.0382794549976,55.6306581452884,56.1763819347232,56.6795988892223,57.1437527733159,57.5712486987402,57.9661672274983,58.3323157727169,58.6723786382633,58.9882156026841,59.2811441392711,59.5539106272016,59.8085754767453,60.0470236606532,60.2723254651720,60.4837209568227,60.6803690511315,60.8626245909699,61.0319710801750,61.1888548176646,61.3349112797290,61.4713591553233,61.5991348285001,61.7186582978769,61.8300158474138,61.9339624498392,62.0310922230531,62.1203705318213,62.2030964813900,62.2795747274378;
                   45.8592389975158,47.7919542135458,49.2939715561577,50.5636179148377,51.6595183146572,52.6285842412855,53.4949528345474,54.2833898680924,55.0109887033417,55.6817421685352,56.2970137133449,56.8620406292664,57.3863490664163,57.8731201842615,58.3229236228278,58.7401403232454,59.1305121257240,59.4945181762249,59.8351044216730,60.1543590976979,60.4537367731081,60.7335323128566,60.9962192467884,61.2440829483582,61.4787119438196,61.6994862124264,61.9063219984830,62.0997066151967,62.2814092531390,62.4511114520202,62.6100651398902,62.7595495718118,62.8999690364675,63.0319701711305,63.1558109152548,63.2725779727555,63.3825291179991,63.4855832599294,63.5824377991762,63.6735677212769;
                   47.9886074118634,49.9618986310601,51.4790228775325,52.7402248271345,53.8155884525285,54.7513376257918,55.5748042097075,56.3079010629052,56.9754096757789,57.5853656053009,58.1455473528525,58.6609336965057,59.1390564070932,59.5812249728476,59.9874968770451,60.3634954397201,60.7149382043180,61.0437644257445,61.3515384772424,61.6405167359684,61.9098815494619,62.1610763430323,62.3963209564542,62.6172873917902,62.8269529339582,63.0238530478423,63.2082199389198,63.3793627553015,63.5401757908204,63.6901449905777,63.8302748041609,63.9623302822437,64.0863534898727,64.2026039444804,64.3119265796953,64.4149400353756,64.5122668408058,64.6035001955619,64.6893111072006,64.7701848832108;];

pixelAcc = [59.7629424526230,62.1046593040550,64.2285694944071,66.1566207985699,67.8822191048322,69.4156572369610,70.7799195920376,71.9934840646315,73.0769758056989,74.0478885040478,74.9204707863011,75.7084821132611,76.4256934738625,77.0816897085976,77.6832958750408,78.2379357794231,78.7518178661264,79.2293619012470,79.6745963627096,80.0911555036860,80.4816137647666,80.8485717205549,81.1939278781263,81.5195519345717,81.8278832214066,82.1194870930650,82.3951544526424,82.6556945507432,82.9031661080965,83.1386100849198,83.3626553900388,83.5764568351612,83.7805568445914,83.9754420822593,84.1615279065981,84.3395567209560,84.5102367112354,84.6737806988873,84.8302916657287,84.9804151959184;
                  64.1838792396700,66.7327975714384,68.8287626225724,70.5935187054351,72.0827058996825,73.3580737029818,74.4672513632729,75.4400349853668,76.3009476084821,77.0684377675290,77.7588359239426,78.3841139070590,78.9552843852582,79.4799991419128,79.9642621437773,80.4122108152255,80.8286359827401,81.2174177185718,81.5809459819515,81.9221359261664,82.2432076185858,82.5463547256791,82.8329124029592,83.1041443054135,83.3619999679737,83.6065260707289,83.8383281262599,84.0582620062981,84.2674168184419,84.4665478211678,84.6565790478277,84.8382934944606,85.0123271733696,85.1790753739594,85.3390119504154,85.4924323450144,85.6400211497768,85.7816468586923,85.9175880363801,86.0481238677564;
                  67.8073316515599,69.8354673998244,71.4336430305435,72.7877951994489,73.9600407860754,74.9941180003672,75.9176261038161,76.7512754059539,77.5091399495764,78.1998576992880,78.8295005821076,79.4070770332584,79.9394877203003,80.4323215906510,80.8889003909751,81.3139803694874,81.7121506892801,82.0856448018074,82.4362312231826,82.7666781325468,83.0791798897034,83.3750296827982,83.6554277852380,83.9218400214134,84.1755321179127,84.4165653422791,84.6456545882318,84.8636435054509,85.0717857553965,85.2704579453905,85.4602655935009,85.6420843218994,85.8161622729709,85.9829074377913,86.1429243857804,86.2966535297716,86.4446412012502,86.5871474792545,86.7241951074942,86.8562424217199;
                  69.6247381501737,71.6637254777492,73.2405077051108,74.5443810287460,75.6546294175317,76.6176173450052,77.4662445576358,78.2212105253592,78.9007939914630,79.5163353971663,80.0781194435643,80.5939542688653,81.0697159419958,81.5094339823514,81.9166807373839,82.2962163516101,82.6523030295773,82.9876281059259,83.3034196090160,83.6020878154163,83.8844857463603,84.1523430398697,84.4064587885972,84.6478477528576,84.8781831124884,85.0972080721146,85.3057945578507,85.5042651343782,85.6940626095949,85.8753629990927,86.0487649984981,86.2152774580448,86.3749301794117,86.5281147569823,86.6755560608974,86.8174042287701,86.9542374587873,87.0862130470940,87.2134563345085,87.3362498910829;];
              
classAcc = [53.6166685540976,55.5967948018896,57.3237320882869,58.8544956209996,60.2017948442793,61.3905329213579,62.4435967537027,63.3767878079031,64.2114199609301,64.9602832099546,65.6349639291829,66.2446959257892,66.8016831382256,67.3131208966184,67.7819893750422,68.2130478820972,68.6114093174701,68.9792673501668,69.3202552246368,69.6372715278773,69.9317591919854,70.2047885169115,70.4591450299554,70.6972544536765,70.9212770194682,71.1315392902723,71.3271970434733,71.5080894239389,71.6770942904036,71.8349143599890,71.9822606155026,72.1205121698443,72.2505036841062,72.3726692253487,72.4868853415123,72.5941389864676,72.6951384233662,72.7893027342883,72.8772228428703,72.9595201816422;
                  58.2632413104251,60.2353123304207,61.8088284225704,63.1336893981146,64.2522717603757,65.2184598723436,66.0651775280590,66.8110797972128,67.4773411932602,68.0744521691954,68.6133065247505,69.1025511198836,69.5503131000282,69.9626189353878,70.3431332264604,70.6937229109175,71.0172920168305,71.3170483190379,71.5947825025662,71.8524681720529,72.0912924509408,72.3130218718437,72.5199644212407,72.7141019101105,72.8979890245044,73.0707432131797,73.2313966149784,73.3802909086031,73.5188269465003,73.6473338643682,73.7673844646293,73.8800121941471,73.9861361209975,74.0860491194630,74.1796769643477,74.2677432245348,74.3508696337558,74.4275792164425,74.4989090969716,74.5651742790338;
                  56.1387661899619,58.1788189832075,59.7172861585686,60.9961248002105,62.0810119108635,63.0262191034398,63.8574442750947,64.6029557452942,65.2839522917626,65.9046916490366,66.4695763149141,66.9859289202305,67.4615153399251,67.9006064300342,68.3043209974268,68.6771714973569,69.0249626715739,69.3483240036955,69.6504064167114,69.9329271849371,70.1971631900816,70.4435344090442,70.6743319516664,70.8916471289184,71.0969316304493,71.2895122660372,71.4695627598046,71.6377906909983,71.7959358292434,71.9438935579413,72.0827232110529,72.2133976518177,72.3363745011860,72.4524566646415,72.5618978136188,72.6652433255044,72.7629114973707,72.8545300250049,72.9407927720727,73.0219786746801;
                  58.5848596437301,60.6169596367486,62.1335559940096,63.3709990729927,64.4110209081841,65.3064372670524,66.0851379127300,66.7700265167037,67.3860572007684,67.9425672186871,68.4487005565344,68.9110172383981,69.3363081138069,69.7278440329552,70.0857388986845,70.4161394356077,70.7242215293931,71.0116479755592,71.2790233847477,71.5295186359740,71.7622088582049,71.9789105969834,72.1807131486495,72.3699825674577,72.5495209400359,72.7177576222189,72.8748266348485,73.0204020523021,73.1571374717956,73.2847225754182,73.4040475916382,73.5165014918121,73.6222449232464,73.7215474325198,73.8150885279631,73.9033173069532,73.9869223114257,74.0653524994930,74.1390167853953,74.2084167886223;];
              
              
w = 1 : size(pixelIOU, 2);

% pixel iou
figure(1)

plot(w(1:subsample:end), pixelIOU(4,1:subsample:end), '-rx', 'LineWidth', lineWidth, 'color', cols(1,:));
hold on
plot(w(1:subsample:end), pixelIOU(3,1:subsample:end), '-ro', 'LineWidth', lineWidth, 'color', cols(3,:));
plot(w(1:subsample:end), pixelIOU(2,1:subsample:end), '-rs', 'LineWidth', lineWidth, 'color', cols(4,:));
plot(w(1:subsample:end), pixelIOU(1,1:subsample:end), '-r+', 'LineWidth', lineWidth, 'color', cols(2,:));

ylabel('mean IOU (%)', 'FontSize', fontSize) 
xlabel('Trimap Width (pixels)', 'FontSize', fontSize)

leg = legend('DL-MSc-CRF', 'DeepLab-CRF', 'DeepLab-MSc', 'DeepLab');
set(leg, 'FontSize', fontSize, 'Position', [0.34 0.20 0.55 0.2]);
set(gca, 'XGrid', 'on')
set(gca, 'YGrid', 'on');
set(gca,'FontSize', fontSize);
set(leg, 'FontSize', fontSize);
set(gcf, 'Color', [1 1 1]);

fn = fullfile(save_folder, 'SegPixelIOUWithinTrimap.pdf');
export_fig(fn);

% pixel acc
figure(2)

plot(w(1:subsample:end), pixelAcc(4,1:subsample:end), '-rx', 'LineWidth', lineWidth, 'color', cols(1,:));
hold on
plot(w(1:subsample:end), pixelAcc(3,1:subsample:end), '-ro', 'LineWidth', lineWidth, 'color', cols(3,:));
plot(w(1:subsample:end), pixelAcc(2,1:subsample:end), '-rs', 'LineWidth', lineWidth, 'color', cols(4,:));
plot(w(1:subsample:end), pixelAcc(1,1:subsample:end), '-r+', 'LineWidth', lineWidth, 'color', cols(2,:));

ylabel('Pixelwise Accuracy (%)', 'FontSize', fontSize) 
xlabel('Trimap Width (pixels)', 'FontSize', fontSize)

leg = legend('DL-MSc-CRF',  'DeepLab-CRF', 'DeepLab-MSc', 'DeepLab');
set(leg, 'FontSize', fontSize, 'Position', [0.34 0.20 0.55 0.2]);
set(gca, 'XGrid', 'on')
set(gca, 'YGrid', 'on');
set(gca,'FontSize', fontSize);
set(leg, 'FontSize', fontSize);
set(gcf, 'Color', [1 1 1]);

fn = fullfile(save_folder, 'SegPixelAccWithinTrimap.pdf');
export_fig(fn);              
              
              
              
              
              
              
% % VOC2011 results (to compare with Berkeley), we show VOC2011 results in ICLR submission
% pixelIOU = [39.8900960385829,41.6853454737786,43.3690413798132,44.9395509846056,46.3750882587993,47.6832306724482,48.8744188141510,49.9531674296874,50.9373884456491,51.8346311055171,52.6502218231060,53.3911188708848,54.0725382526626,54.7005916819390,55.2782772926504,55.8116488652938,56.3060565929080,56.7629125404939,57.1872015162243,57.5816476314979,57.9487393173513,58.2892769291146,58.6050312440186,58.8989773925030,59.1741229868887,59.4316811502284,59.6709738126791,59.8917985734924,60.0972879225545,60.2885564329489,60.4665539691731,60.6323497419556,60.7869043641704,60.9311753766987,61.0649683565156,61.1898413167371,61.3061432242137,61.4136633760218,61.5130980516398,61.6055998451289;
%                    41.5828378715938,43.5766579036687,45.3789758989861,46.9973645296769,48.4237754405039,49.6824316968176,50.8008899724756,51.8018073390649,52.7087192093877,53.5322849330015,54.2802197225679,54.9583762861588,55.5812901954668,56.1538611198840,56.6797263668934,57.1651189941990,57.6170584161853,58.0358544903772,58.4248087226072,58.7866106198654,59.1233489611298,59.4351449842387,59.7233408587008,59.9912261858901,60.2420988061581,60.4767049355425,60.6940046551510,60.8939040755093,61.0795929993691,61.2524585607752,61.4136761611846,61.5640053685921,61.7042230266774,61.8344805654244,61.9546900607201,62.0666088961552,62.1707050976009,62.2668185922829,62.3558532788028,62.4387504679607;
%                    46.8008114753357,48.8034774719520,50.3351451844234,51.6162150706372,52.7251742142864,53.7086533263507,54.5919252828876,55.3946493336702,56.1359299886895,56.8221967915863,57.4506647982475,58.0269922465652,58.5617630219582,59.0573412820618,59.5139608904328,59.9366989287072,60.3315311487844,60.6981557959748,61.0405384660657,61.3611055743138,61.6619441808216,61.9432686917370,62.2060247637012,62.4525857905467,62.6853676467449,62.9036147497263,63.1074458490209,63.2973555263103,63.4756631122402,63.6419003411812,63.7972092675849,63.9429267839041,64.0791161181367,64.2066343261233,64.3257230086024,64.4378419502275,64.5431484315332,64.6414419231888,64.7338604615733,64.8210406552364;
%                    47.9455373302949,49.9905323102095,51.5627297610953,52.8578158143203,53.9626222771367,54.9297168922372,55.7918150067340,56.5672874026159,57.2785770987823,57.9348875932030,58.5363828052990,59.0880830538765,59.5976983849393,60.0692259297900,60.5038046283172,60.9085949293639,61.2857185525507,61.6366599715668,61.9648588996006,62.2727423744782,62.5611298890884,62.8308181392883,63.0823527041710,63.3181473459176,63.5401962164337,63.7476964282865,63.9405263768821,64.1193782185736,64.2874085929974,64.4442141332753,64.5902693512550,64.7271298417687,64.8556885536654,64.9761503389378,65.0887029164057,65.1943790384960,65.2936530653820,65.3865357237269,65.4738142308921,65.5563357479360;];
%                    %45.5074956927754,47.6113072357874,49.4758834273751,51.1378459245196,52.6028453787499,53.8972648254385,55.0553401111117,56.0962869550326,57.0347711246163,57.8809030767467,58.6485288031212,59.3441092659707,59.9799812820801,60.5653581872316,61.1045156855529,61.6032783038688,62.0667718727176,62.4955383384313,62.8942733712646,63.2659308223728,63.6136210307631,63.9381918974838,64.2397741869811,64.5222517135706,64.7877317808074,65.0361075727873,65.2683456848544,65.4848035356190,65.6880735780994,65.8790765331579,66.0588312519485,66.2278521965968,66.3871642287961,66.5373969898319,66.6784488123415,66.8112801688544,66.9368243672950,67.0546205993560,67.1654423440488,67.2698128080155;];
%                    
% pixelAcc = [59.8702316669570,62.2222056484383,64.3658834586713,66.3147232906876,68.0589752234301,69.6098786727436,70.9877811818458,72.2110473066879,73.3039923861058,74.2829587049834,75.1618263625260,75.9545240081541,76.6749304736787,77.3325909254301,77.9351834355253,78.4907599278953,79.0052439918971,79.4828805981094,79.9277833905629,80.3436249292670,80.7333742942592,81.0991103616966,81.4424081138104,81.7651822745402,82.0703914417594,82.3589214746141,82.6317639897833,82.8894591308832,83.1341198726397,83.3667831080903,83.5881991422080,83.7994032902665,84.0010253803953,84.1937286072606,84.3776621746214,84.5537123489286,84.7225784253176,84.8843760563059,85.0392436238521,85.1878887495872;
%                   61.8147244963131,64.3456823895273,66.5661902157912,68.5032103723578,70.1722568400917,71.6103937958977,72.8609848796770,73.9583910873371,74.9320684053056,75.8005153640624,76.5799185715866,77.2831847051774,77.9229265348431,78.5075103411444,79.0442217111538,79.5401231885116,80.0016417340956,80.4317103635571,80.8330563720170,81.2092185153414,81.5630253321085,81.8957063520432,82.2082491411739,82.5026697134346,82.7816202060511,83.0457223476033,83.2955360886606,83.5315797063935,83.7558993243433,83.9695887349384,84.1733733123382,84.3679730389745,84.5538209008307,84.7313053314962,84.9007128398542,85.0630719699243,85.2191588698386,85.3690449708700,85.5128694421863,85.6511757325939;
%                   67.9899698078151,70.0567442821183,71.6749688129097,73.0351486950012,74.2131554815988,75.2522471156235,76.1798686662320,77.0155780095065,77.7756652044063,78.4688236760881,79.1002101987149,79.6789407980391,80.2120573105576,80.7037810138604,81.1577714707696,81.5799416398628,81.9745756376541,82.3438301057336,82.6900634015779,83.0162352419576,83.3248015795992,83.6168350531022,83.8930004244723,84.1546437639513,84.4036904843531,84.6401217409859,84.8647677297657,85.0783263996731,85.2822134329573,85.4768198340270,85.6626583036535,85.8406793412644,86.0110316366263,86.1742309356537,86.3306843416750,86.4810564998195,86.6260232643489,86.7656670201423,86.9001674776055,87.0299350996221;
%                   69.0053513712284,71.0950651600423,72.7213510449280,74.0644309089864,75.2114109187087,76.2105631374151,77.0972069031764,77.8888352795387,78.6043794185371,79.2540992817565,79.8459072666722,80.3884332131330,80.8876001032195,81.3479628219528,81.7734899783075,82.1701895074667,82.5407187717594,82.8880801350726,83.2144835792190,83.5225342344795,83.8141166121929,84.0903208591311,84.3516019975667,84.5990892569557,84.8346239224181,85.0581154792467,85.2703572944005,85.4720287941918,85.6647880955960,85.8489897155208,86.0248908240345,86.1934913858449,86.3550938115026,86.5101338341557,86.6589502948077,86.8021554804803,86.9404413402168,87.0739487027975,87.2026871369159,87.3270758459294;];
%                   %63.8144487023167,66.3086055145446,68.4634780241390,70.3303283301436,71.9397695355219,73.3322698083738,74.5508066478873,75.6263397301993,76.5807723550267,77.4309068110563,78.1958004632172,78.8868711151582,79.5154457463512,80.0906205770541,80.6198231636825,81.1096277928439,81.5648123332702,81.9882275044303,82.3837539798002,82.7545410792287,83.1034025270834,83.4322713413900,83.7417398617509,84.0339715292647,84.3111616023673,84.5734845666827,84.8221849431542,85.0580683911263,85.2827820688194,85.4972248335222,85.7020840784415,85.8980820080648,86.0857121463602,86.2654634901012,86.4375543086615,86.6026924978286,86.7617287195415,86.9145552021604,87.0613582609283,87.2024483879291;];
% 
% classAcc = [54.6155793470211,56.6176771219543,58.3792159551627,59.9470964063823,61.3275610759142,62.5460802457132,63.6234384332441,64.5744885138283,65.4263077736086,66.1921984127533,66.8817178042725,67.5035729013805,68.0713375326161,68.5919942614890,69.0685302825447,69.5069027256570,69.9116959350726,70.2839301164267,70.6276617508124,70.9461789558870,71.2417517009927,71.5145587132089,71.7670940952535,72.0019917228125,72.2219123007297,72.4279278404599,72.6194736466020,72.7962688811345,72.9612394049729,73.1151164090523,73.2590370870242,73.3938289696185,73.5202817889312,73.6389899976090,73.7497025753468,73.8537007175087,73.9514878151864,74.0425951158703,74.1276281015811,74.2073715895642;
%                   56.3381859447377,58.4329242734160,60.2162185597091,61.7509692974489,63.0632673314765,64.1977331506007,65.1848278084278,66.0561569137452,66.8402996285973,67.5474044378348,68.1845726878207,68.7592063707104,69.2837451155814,69.7645557532836,70.2047916250318,70.6099720144363,70.9858000321760,71.3323387493509,71.6518587519223,71.9479655263748,72.2220882578955,72.4740807573813,72.7068387662100,72.9230760275906,73.1255474823514,73.3146551586576,73.4900482804681,73.6518004650773,73.8027455550803,73.9438411719511,74.0761591068355,74.2002379113205,74.3169996696984,74.4264346848208,74.5281857083659,74.6233795576599,74.7125666699986,74.7956326829670,74.8734071159704,74.9465001233577;
%                   57.0628358746184,59.1843231126464,60.7749678483826,62.0798919600122,63.1884116318696,64.1545883374433,65.0051728647461,65.7651327708617,66.4588209525697,67.0931260961699,67.6683365145782,68.1926193858307,68.6759619168704,69.1211298869311,69.5282602915092,69.9026925403452,70.2503642637778,70.5716747537857,70.8709886673587,71.1499979087586,71.4107866171383,71.6536884905143,71.8799358001762,72.0916313657099,72.2911407475121,72.4775491264770,72.6513741965087,72.8132786891891,72.9655202503474,73.1077504531443,73.2410380071814,73.3663888577533,73.4839912201853,73.5948294153593,73.6990883561233,73.7975116248776,73.8903742471384,73.9771975834496,74.0590980669097,74.1363110687188;
%                   58.1345140398146,60.2619141972833,61.8719771167414,63.1726283922529,64.2700985819496,65.2200645219860,66.0517431814058,66.7886641859442,67.4559923931502,68.0648740156886,68.6174292010922,69.1212323620224,69.5831960074364,70.0084490010720,70.3981023967218,70.7594156021684,71.0938518912604,71.4035399907820,71.6914148579963,71.9602602948323,72.2108962041685,72.4441832291895,72.6614976336657,72.8650320223795,73.0566796816106,73.2354668271476,73.4015784442158,73.5557201551317,73.7007265996142,73.8365859024915,73.9636293182299,74.0832433215427,74.1961592735999,74.3027769122786,74.4030766249756,74.4976671728030,74.5869011168282,74.6706436330185,74.7496221832422,74.8242735081491;];
%                   %61.3653658215760,63.4349123626891,65.1633350457429,66.6397018905788,67.8994738985810,68.9843597530749,69.9367920039521,70.7813599554954,71.5364804027757,72.2120052778147,72.8207260053494,73.3693530260855,73.8685825461497,74.3262118713101,74.7450449888681,75.1298128727821,75.4855010912007,75.8120010670598,76.1124451842337,76.3903665222748,76.6484451351529,76.8876449571008,77.1088897732981,77.3153050290478,77.5089204374066,77.6891627952232,77.8572117519692,78.0132597936554,78.1595572412126,78.2966024236190,78.4256359231221,78.5468647906512,78.6614453012275,78.7700920430846,78.8725137574794,78.9688899317567,79.0601793653758,79.1461734515757,79.2273426416995,79.3040486837078;];


% w = 1 : size(pixelIOU, 2);
% 
% % pixel iou
% figure(1)
% 
% %plot(w(1:subsample:end), pixelIOU(4,1:subsample:end), '-rx', 'LineWidth', lineWidth, 'color', cols(1,:));
% hold on
% plot(w(1:subsample:end), pixelIOU(3,1:subsample:end), '-ro', 'LineWidth', lineWidth, 'color', cols(1,:));
% %plot(w(1:subsample:end), pixelIOU(2,1:subsample:end), '-rs', 'LineWidth', lineWidth, 'color', cols(2,:));
% plot(w(1:subsample:end), pixelIOU(1,1:subsample:end), '-r+', 'LineWidth', lineWidth, 'color', cols(4,:));
% %plot(w(1:subsample:end), pixelIOU(5,1:subsample:end), '-rd', 'LineWidth', lineWidth, 'color', cols(9,:));
% 
% ylabel('mean IOU (%)', 'FontSize', fontSize) 
% xlabel('Trimap Width (pixels)', 'FontSize', fontSize)
% 
% %leg = legend('DL-MSc-CRF', 'DeepLab-CRF', 'DeepLab-MSc', 'DeepLab');
% leg = legend( 'DeepLab-CRF', 'DeepLab');
% set(leg, 'FontSize', fontSize, 'Position', [0.34 0.20 0.55 0.2]);
% set(gca, 'XGrid', 'on')
% set(gca, 'YGrid', 'on');
% set(gca,'FontSize', fontSize);
% set(leg, 'FontSize', fontSize);
% set(gcf, 'Color', [1 1 1]);
% 
% fn = fullfile(save_folder, 'SegPixelIOUWithinTrimap.pdf');
% export_fig(fn);
% 
% % pixel acc
% figure(2)
% 
% %plot(w(1:subsample:end), pixelAcc(4,1:subsample:end), '-rx', 'LineWidth', lineWidth, 'color', cols(1,:));
% hold on
% plot(w(1:subsample:end), pixelAcc(3,1:subsample:end), '-ro', 'LineWidth', lineWidth, 'color', cols(1,:));
% %plot(w(1:subsample:end), pixelAcc(2,1:subsample:end), '-rs', 'LineWidth', lineWidth, 'color', cols(2,:));
% plot(w(1:subsample:end), pixelAcc(1,1:subsample:end), '-r+', 'LineWidth', lineWidth, 'color', cols(4,:));
% %plot(w(1:subsample:end), pixelAcc(5,1:subsample:end), '-rd', 'LineWidth', lineWidth, 'color', cols(9,:));
% 
% ylabel('Pixelwise Accuracy (%)', 'FontSize', fontSize) 
% xlabel('Trimap Width (pixels)', 'FontSize', fontSize)
% 
% %leg = legend('DL-MSc-CRF',  'DeepLab-CRF', 'DeepLab-MSc', 'DeepLab');
% leg = legend( 'DeepLab-CRF', 'DeepLab');
% set(leg, 'FontSize', fontSize, 'Position', [0.34 0.20 0.55 0.2]);
% set(gca, 'XGrid', 'on')
% set(gca, 'YGrid', 'on');
% set(gca,'FontSize', fontSize);
% set(leg, 'FontSize', fontSize);
% set(gcf, 'Color', [1 1 1]);
% 
% fn = fullfile(save_folder, 'SegPixelAccWithinTrimap.pdf');
% export_fig(fn);
